const { DataTypes } = require("sequelize");
const seq = require("../db/seq.js");
const Nodes = seq.define(
  "nodes",
  {
    nodeId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      comment: "节点ID",
    },
    nodeName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "监测站名称",
    },
    nodeCode: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "编号",
    },
    nodeType: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "类别",
    },
    codeInfo: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "编码信息",
    },
    wavelength: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "波长",
    },
    distance: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "监测站的距离",
    },
    joinTime: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 0,
      comment: "接入时间",
    },
    nodeAttr: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "属性",
    },
    station: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "监测站",
    },
    stationPort: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "监测站接口",
    },
    extendChannel: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      comment: "扩展盘通道",
    },
    linkName: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "监测站名称",
    },
    longitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "经度",
    },
    latitude: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: "",
      comment: "纬度",
    },
  },
  {
    freezeTableName: true,
    timestamps: false,
  }
);
module.exports = Nodes;